<template>
  <el-dialog
    title="学生选择"
    width="90%"
    top="1%"
    center
    :visible.sync="visible"
    :before-close="handleBeforeClose"
    :close-on-click-modal="false"
    class="word-dialog"
  >
    <StudentIndex @on-select="chooseStudent"/>
  </el-dialog>
</template>

<script>
import StudentIndex from '@/views/student/indexDiaog.vue'

export default {
  name: 'StudentChooseDialog',
  components: {
    StudentIndex
  },
  props: {
    value: Boolean
  },
  data() {
    return {
      visible: this.value
    }
  },
  watch: {
    value(val) {
      this.visible = val
    },
    visible(val) {
      this.$emit('input', val)
    }
  },
  methods: {
    handleBeforeClose(done) {
      done()
    },
    chooseStudent(student) {
      this.$emit('on-select', student)
    }
  }
}
</script>

<style scoped>
::v-deep .el-dialog__body{
  padding: 0 !important;
}
</style>
